package com.googlecode.sparda.commons.io.stream;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * A {@link ManagedOutputStream} implementation for for {@link FileOutputStream}.
 * @author Fabio Grucci (<i>alias</i> <b>Phoenix</b>)
 * @version 0.1
 * @since 0.1
 */
public class PooledFileOutputStream extends ManagedOutputStream<FileOutputStream> {
	/**
	 * The {@link File}
	 */
	private final File file;
	/**
	 * Build a new {@link PooledFileOutputStream}.
	 * @param outputStreamManager The manager that manage the stream.
	 * @param file The {@link File} where write
	 * @throws IOException If raised an {@link IOException}
	 */
	public PooledFileOutputStream(OutputStreamManager outputStreamManager, File file) throws IOException {
		super(outputStreamManager, new FileOutputStream(file));
		this.file = file;
	}
	/*
	 * (non-Javadoc)
	 * @see it.chi.utils.io.ManagedOutputStream#reopenDelegate()
	 */
	@Override
	protected FileOutputStream reopenDelegate() throws IOException {
		return new FileOutputStream(file, true);
	}

}
